/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import entities.*;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;


/**
 *
 * @author kheirarahali
 */
@Stateless
public class Idao implements IdaoLocal, IdaoRemote{
    @PersistenceContext(unitName = "EcomEntrepriseApp-ejbPU")
    private EntityManager em;

    @Override
    public List<Account> getAllAccounts() {
        return em.createQuery("SELECT a FROM Account a").getResultList();
    }

    @Override
    public List<Product> getAllProducts() {
        return em.createQuery("SELECT p FROM Product p").getResultList();
    }
}
